/*************************************************************************
	> File Name: B3940.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-06-24 11:06:13
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int arr[25][25] = {}, n;
    cin >> n;
    arr[0][n / 2] = 1;
    int cnt = 2, x = 0, y = n / 2;
    while (cnt <= n * n) {
        int dx = (x ? x - 1 : n - 1);
        int dy = (y != n - 1 ? y + 1 : 0);
        if (arr[dx][dy] == 0) {
            arr[dx][dy] = cnt++;
        } else {
            dx = (x != n - 1 ? x + 1 : 0);
            dy = y;
            arr[dx][dy] = cnt++;
        }
        x = dx;
        y = dy;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << arr[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}
